package com.sleepingcat.ft_flutter.channel

import com.cat.android.lib_base.base.RouterActivity
import com.idlefish.flutterboost.FlutterBoost
import com.sleepingcat.ft_flutter.fragment.MyFlutterFragment
import com.sleepingcat.ft_flutter.pigeons.CommonBridge
import com.sleepingcat.lib_common.const.Routes
import com.sleepingcat.lib_common.service.IFlutter
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.engine.plugins.FlutterPlugin
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch

class CommonChannel(engine: FlutterEngine) : FlutterPlugin, CommonBridge.CommonHostApi, CoroutineScope by MainScope() {

    val flutterApi by lazy { CommonBridge.CommonFlutterApi(engine.dartExecutor) }

    override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) {
        CommonBridge.CommonHostApi.setup(binding.binaryMessenger, this)
    }

    override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
        CommonBridge.CommonHostApi.setup(binding.binaryMessenger, null)
    }

    override fun requestEnv(): String {
        return ""
    }

    override fun switchPreOnline(flag: String) {

    }

    override fun getDeviceId(): String {
        return ""
    }

}